home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / c / c-tools-.000 / c-tools- / c-tools-0.4 / hashtest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-13  |  728 b   |  26 lines

  1. #include <assert.h>
  2. #include <stdio.h>
  3.  
  4. #include "hash.h"
  5.  
  6. int
  7. main ()
  8. {
  9.     struct hash_table *table;
  10.  
  11.     assert ((table = hash_table_build ()) != NULL);
  12.     assert (hash_table_add (table, "hello") == HASH_OK);
  13.     assert (hash_table_add (table, "world") == HASH_OK);
  14.     assert (hash_table_add (table, "cat") == HASH_OK);
  15.     assert (hash_table_lookup (table, "dd") == HASH_NOT_FOUND);
  16.     assert (hash_table_lookup (table, "f") == HASH_NOT_FOUND);
  17.     assert (hash_table_lookup (table, "hello") == HASH_OK);
  18.     assert (hash_table_lookup (table, "cat") == HASH_OK);
  19.     assert (hash_table_lookup (table, "world") == HASH_OK);
  20.     assert (hash_table_free (table) == HASH_OK);
  21.  
  22.     printf ("all seems ok\n");
  23.  
  24.     return 0;
  25. }
  26.